package o;

import android.app.Fragment;
import android.os.Bundle;
import com.huawei.hmf.annotation.FragmentDefine;

public class fiw {
    private Fragment ॱ;

    fiw(Fragment fragment) {
        this.ॱ = fragment;
    }

    public <T> T ˏ() {
        Bundle arguments = this.ॱ.getArguments();
        if (arguments == null) {
            return null;
        }
        if (this.ॱ.getActivity() != null) {
            return new fje(arguments).ॱ((FragmentDefine) this.ॱ.getClass().getAnnotation(FragmentDefine.class));
        }
        throw new IllegalArgumentException("Activity is null, fragment may not bind to any activity");
    }

    public static fiw ˊ(Fragment fragment) {
        return new fiw(fragment);
    }

    static fiw ˎ(Object obj, Bundle bundle) {
        if (!(obj instanceof Fragment)) {
            return new fjd(obj, bundle);
        }
        Fragment fragment = (Fragment) obj;
        fragment.setArguments(bundle);
        return ˊ(fragment);
    }

    public <T extends Fragment> T ˊ() {
        return this.ॱ;
    }

    public <R> R ˎ(Class<R> cls) {
        if (cls.isInstance(this.ॱ)) {
            return this.ॱ;
        }
        return null;
    }
}
